import {createRouter, createWebHistory} from 'vue-router'
import brand from '@/components/brand.vue'
import supplierLogin from '@/components/supplierLogin.vue'
import firstPage from '@/view/firstPage.vue'
import category from '@/components/category.vue'
import product from '@/components/product.vue'
import upload from '@/components/upload.vue'
import supplierPage from '@/view/supplierPage.vue'
import supplier from '@/components/supplier.vue'
import profile from '@/components/profile.vue'
import productDetailPage from '@/components/productDetailPage.vue'
import user from '@/components/user.vue'
import orderPage from '@/components/orderPage.vue'
import orderDetailPage from '@/components/orderDetailPage.vue'
import orderControlPage from '@/components/orderControlPage.vue'
import orderStaticPage from '@/components/orderStaticPage.vue'

const routes = [
    {path: '/', component: firstPage},
    {path: '/supplier/login', component: supplierLogin},
    {
        path: '/control',
        component: supplierPage,
        redirect: '/supplier/product',
        children: [
            {path: '/supplier/product', component: product},
            {path: '/supplier/brand', component: brand},
            {path: '/supplier/category', component: category},
            {path: '/supplier/standard', component: category},
            {path: '/supplier/info', component: supplier},
            {path: '/profile', component: profile}
        ]
    },
    {path: '/orderDetail/:orderId', component: orderDetailPage},
    {path: '/productDetail/:productId', component: productDetailPage},
    {path: '/userInfo', component: user},
    {
        path: '/order', redirect: '/order/control', component: orderPage,
        children: [
            {path: '/order/control', component: orderControlPage},
            {path: '/order/static', component: orderStaticPage}
        ]
    }
]

const router = createRouter({
    history: createWebHistory(),
    routes: routes
})
export default router

